Extra insurance that we don't mix events in the wrong timelines - v2#2856
Merged
MadLittleMods merged 10 commits intodevelopfrom Nov 7, 2022
Merged
Extra insurance that we don't mix events in the wrong timelines - v2#2856MadLittleMods merged 10 commits intodevelopfrom
MadLittleMods merged 10 commits intodevelopfrom
Conversation
Fix test failure in `sliding-sync/sliding-sync.ts` -> `"should show the right unread notifications"`
```
Cannot call `EventTimelineSet::canContain without a `room` set. Set the room when creating the EventTimelineSet to call this method.
at EventTimelineSet.canContain (VM4503 200:726:13)
at EventTimelineSet.addEventToTimeline (VM4503 200:576:15)
at EventTimelineSet.addLiveEvent (VM4503 200:527:10)
at eval (VM4587 281:722:145)
at Array.forEach (<anonymous>)
at SlidingSyncSdk.purgeNotifications (VM4587 281:720:22)
at SlidingSyncSdk.onLifecycle (VM4587 281:263:14)
at SlidingSync.emit (VM4407 21:153:5)
at SlidingSync.emit (VM4472 169:45:18)
at SlidingSync.invokeLifecycleListeners (VM4588 282:378:10)
```
3 tasks
MadLittleMods
commented
Nov 4, 2022
| // | ||
| // We can only run this check for timelines with a `room` because `canContain` | ||
| // requires it | ||
| if (this.room && !this.canContain(event)) { |
Contributor
Author
There was a problem hiding this comment.
Main change from v1 is here. We added the extra this.room check as canContain requires it
MadLittleMods
commented
Nov 4, 2022
Comment on lines
207
to
222
| describe('non-room timeline', () => { | ||
| fit('Adds event to timeline', () => { | ||
| const nonRoomEventTimelineSet = new EventTimelineSet( | ||
| // This is what we're specifically testing against, a timeline | ||
| // without a `room` defined | ||
| undefined, | ||
| ); | ||
| const nonRoomEventTimeline = new EventTimeline(nonRoomEventTimelineSet); | ||
|
|
||
| expect(nonRoomEventTimeline.getEvents().length).toStrictEqual(0); | ||
| nonRoomEventTimelineSet.addEventToTimeline(messageEvent, nonRoomEventTimeline, { | ||
| toStartOfTimeline: true, | ||
| }); | ||
| expect(nonRoomEventTimeline.getEvents().length).toStrictEqual(1); | ||
| }); | ||
| }); |
Contributor
Author
There was a problem hiding this comment.
Added a test for a non-room timeline scenario that would fail without the additional this.room check added in this PR compared to v1.
MadLittleMods
commented
Nov 4, 2022
t3chguy
reviewed
Nov 7, 2022
Member
|
@MadLittleMods I suggest waiting on the auto assigned reviewers, if you're waiting on me it'll be end of week due to the fires I'm dealing with |
robintown
reviewed
Nov 7, 2022
Member
robintown
left a comment
There was a problem hiding this comment.
The main substance of the change looks good
robintown
approved these changes
Nov 7, 2022
MadLittleMods
added a commit
to matrix-org/matrix-react-sdk
that referenced
this pull request
Nov 7, 2022
Fixes tests failing from changes made by matrix-org/matrix-js-sdk#2856
Contributor
Author
|
Thanks for the review @t3chguy and @robintown 🐄 |
su-ex
added a commit
to SchildiChat/matrix-js-sdk
that referenced
this pull request
Nov 25, 2022
* Make calls go back to 'connecting' state when media lost ([\matrix-org#2880](matrix-org#2880)). * Add ability to send unthreaded receipt ([\matrix-org#2878](matrix-org#2878)). * Add way to abort search requests ([\matrix-org#2877](matrix-org#2877)). * sliding sync: add custom room subscriptions support ([\matrix-org#2834](matrix-org#2834)). * webrtc: add advanced audio settings ([\matrix-org#2434](matrix-org#2434)). Contributed by @MrAnno. * Add support for group calls using MSC3401 ([\matrix-org#2553](matrix-org#2553)). * Make the js-sdk conform to tsc --strict ([\matrix-org#2835](matrix-org#2835)). Fixes matrix-org#2112 matrix-org#2116 and matrix-org#2124. * Let leave requests outlive the window ([\matrix-org#2815](matrix-org#2815)). Fixes element-hq/element-call#639. * Add event and message capabilities to RoomWidgetClient ([\matrix-org#2797](matrix-org#2797)). * Misc fixes for group call widgets ([\matrix-org#2657](matrix-org#2657)). * Support nested Matrix clients via the widget API ([\matrix-org#2473](matrix-org#2473)). * Set max average bitrate on PTT calls ([\matrix-org#2499](matrix-org#2499)). Fixes element-hq/element-call#440. * Add config option for e2e group call signalling ([\matrix-org#2492](matrix-org#2492)). * Enable DTX on audio tracks in calls ([\matrix-org#2482](matrix-org#2482)). * Don't ignore call member events with a distant future expiration date ([\matrix-org#2466](matrix-org#2466)). * Expire call member state events after 1 hour ([\matrix-org#2446](matrix-org#2446)). * Emit unknown device errors for group call participants without e2e ([\matrix-org#2447](matrix-org#2447)). * Mute disconnected peers in PTT mode ([\matrix-org#2421](matrix-org#2421)). * Add support for sending encrypted to-device events with OLM ([\matrix-org#2322](matrix-org#2322)). Contributed by @robertlong. * Support for PTT group call mode ([\matrix-org#2338](matrix-org#2338)). * Fix registration add phone number not working ([\matrix-org#2876](matrix-org#2876)). Contributed by @bagvand. * Use an underride rule for Element Call notifications ([\matrix-org#2873](matrix-org#2873)). Fixes element-hq/element-web#23691. * Fixes unwanted highlight notifications with encrypted threads ([\matrix-org#2862](matrix-org#2862)). * Extra insurance that we don't mix events in the wrong timelines - v2 ([\matrix-org#2856](matrix-org#2856)). Contributed by @MadLittleMods. * Hide pending events in thread timelines ([\matrix-org#2843](matrix-org#2843)). Fixes element-hq/element-web#23684. * Fix pagination token tracking for mixed room timelines ([\matrix-org#2855](matrix-org#2855)). Fixes element-hq/element-web#23695. * Extra insurance that we don't mix events in the wrong timelines ([\matrix-org#2848](matrix-org#2848)). Contributed by @MadLittleMods. * Do not freeze state in `initialiseState()` ([\matrix-org#2846](matrix-org#2846)). * Don't remove our own member for a split second when entering a call ([\matrix-org#2844](matrix-org#2844)). * Resolve races between `initLocalCallFeed` and `leave` ([\matrix-org#2826](matrix-org#2826)). * Add throwOnFail to groupCall.setScreensharingEnabled ([\matrix-org#2787](matrix-org#2787)). * Fix connectivity regressions ([\matrix-org#2780](matrix-org#2780)). * Fix screenshare failing after several attempts ([\matrix-org#2771](matrix-org#2771)). Fixes element-hq/element-call#625. * Don't block muting/unmuting on network requests ([\matrix-org#2754](matrix-org#2754)). Fixes element-hq/element-call#592. * Fix ICE restarts ([\matrix-org#2702](matrix-org#2702)). * Target widget actions at a specific room ([\matrix-org#2670](matrix-org#2670)). * Add tests for ice candidate sending ([\matrix-org#2674](matrix-org#2674)). * Prevent exception when muting ([\matrix-org#2667](matrix-org#2667)). Fixes element-hq/element-call#578. * Fix race in creating calls ([\matrix-org#2662](matrix-org#2662)). * Add client.waitUntilRoomReadyForGroupCalls() ([\matrix-org#2641](matrix-org#2641)). * Wait for client to start syncing before making group calls ([\matrix-org#2632](matrix-org#2632)). Fixes matrix-org#2589. * Add GroupCallEventHandlerEvent.Room ([\matrix-org#2631](matrix-org#2631)). * Add missing events from reemitter to GroupCall ([\matrix-org#2527](matrix-org#2527)). Contributed by @toger5. * Prevent double mute status changed events ([\matrix-org#2502](matrix-org#2502)). * Don't mute the remote side immediately in PTT calls ([\matrix-org#2487](matrix-org#2487)). Fixes element-hq/element-call#425. * Fix some MatrixCall leaks and use a shared AudioContext ([\matrix-org#2484](matrix-org#2484)). Fixes element-hq/element-call#412. * Don't block muting on determining whether the device exists ([\matrix-org#2461](matrix-org#2461)). * Only clone streams on Safari ([\matrix-org#2450](matrix-org#2450)). Fixes element-hq/element-call#267. * Set PTT mode on call correctly ([\matrix-org#2445](matrix-org#2445)). Fixes element-hq/element-call#382. * Wait for mute event to send in PTT mode ([\matrix-org#2401](matrix-org#2401)). * Handle other members having no e2e keys ([\matrix-org#2383](matrix-org#2383)). Fixes element-hq/element-call#338. * Fix races when muting/unmuting ([\matrix-org#2370](matrix-org#2370)).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add checks to
addEventToTimelineas extra insurance that we don't mix events in the wrong timelines (main timeline vs thread timeline).Split out from #2521
This PR is a v2 of #2848 since it was reverted in #2853
Previously, we just relied on the callers to make sure they're doing the right thing and since it's easy to get it wrong, we mixed and bugs happened.
Dev notes
TimelineSet.addEventsToTimeline->TimelineSet.addEventToTimeline->Timeline.addEventTimelineSet.addEventToTimeline->Timeline.addEventTimelineSet.addLiveEvent->TimelineSet.addEventToTimeline->Timeline.addEventTodo
matrix-react-sdkCypress tests pass with these changesmatrix-react-sdk,yarn jest test/components/structures/ThreadView-test.tsxpass with these changesmatrix-react-sdk,yarn jest test/Notifier-test.tspass with these changesChecklist
Sign-off given on the changes (see CONTRIBUTING.md)Here's what your changelog entry will look like:
🐛 Bug Fixes